// 全局注册以大写F开头的公共组件,

import { upperFirst, camelCase } from 'lodash'

export const status = 1
export default (app) => {
  const commonComponent = require.context('@/components', true, /F[A-Z]\w+\.(vue|js)$/)
  commonComponent.keys().forEach(fileName => {
    const componentConfig = commonComponent(fileName)
    const componentName = upperFirst(camelCase(componentConfig.default && componentConfig.default.name || fileName .split('/') .pop() .replace(/\.\w+$/, '')))
    app.component(componentName, componentConfig.default || componentConfig)
  })
}
